{extend name="public/base" /}
{block name="head"}
    <meta charset="UTF-8">
    <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

    <link href="/resource/ui-framework/easyui-1.5.2/themes/metro/easyui-c5a176a3d4.css" rel="stylesheet" />
    <link href="/resource/ui-framework/easyui-1.5.2/themes/icon-77a4ded0c8.css" rel="stylesheet" />

    <link href="/resource/ui-framework/bootstrap/3.0.3/css/bootstrap-a067b6d831.min.css" rel="stylesheet" />
    <link href="/resource/ui-framework/bootstrap-daterangepicker/css/daterangepicker-886dba62c4.css" rel="stylesheet" />
    <link href="/resource/ui-framework/font-awesome/css/font-awesome-a81d284b37.css" rel="stylesheet" />

    <link href="/resource/ui-framework/admin-lte/css/AdminLET-7d58b99a7e.css" rel="stylesheet" />
    <link href="/static/css/base-dc47892812.css" rel="stylesheet" />

    <link href="/resource/ui-framework/jason/searchbox/css/searchbox-398327fb84.css" rel="stylesheet" />
    <link href="/resource/ui-framework/jason/pager/css/pager-f077f5e880.css" rel="stylesheet" />
    <link href="/resource/ui-framework/jason/status/css/status-5f59ab3856.css" rel="stylesheet" />
    <link href="/resource/ui-framework/jason/selector/css/selector-23060c280e.css" rel="stylesheet" />
    <link href="/resource/ui-framework/jason/button/css/button-5ef10c798a.css" rel="stylesheet" />
    <link href="/resource/ui-framework/jason/orderarrow/css/orderarrow-dcf8eba7d1.css" rel="stylesheet" />

    <link href="/static/css/table-0e491bc98f.css" rel="stylesheet" />
    <link href="/static/css/easyui-ext-372f902530.css" rel="stylesheet" />
{/block}
{block name="content"}
<section class="content">
<div class="container" style="width:100%;">
    <div class="row">
        <div class="col-md-6">
            <ul>  
                <li class="ml10 fl">
                    岗位名：{$group['title']}
                </li>
                <li class="fr">
                    <a href="/index/Authgroup/index" class="btn-action">岗位管理</a>
                </li>
            </ul>
        </div>
        <div class="col-md-6">
            订单查看权限（根据状态)
        </div>
    </div>
    <div class="row mt10">
        <div class="col-md-6">
            <table class="order">
                <tbody>
                    <tr class="header">
                        <td style="width:100px;">模块名</td>
                        <td>功能名</td>
                    </tr>
                    {volist name=":getAuthRule()" id="vo"}
                    <tr class="project">
                        <td >{$vo.title}</td>
                        <td style="text-align:left;text-indent:10px;">
                            {volist name=":getAuthRule($vo.id)" id="voo"}
                            <input type="checkbox" name="ids[]" value="{$voo.id}" {if condition="in_array($voo.id,$rules)"}checked{/if}>{$voo.title}
                            {/volist}
                        </td>
                    </tr>
                    {/volist}
                </tbody>
            </table>
        </div>
    </div>
    <div class="row mt10">
        <div class="col-md-12" style="text-align:center;">
            <a onclick="btnUpdate()" class="btn-action">提交修改</a>
        </div>
    </div>
</div>
</section>
{/block}
{block name="script"}
<script src="/resource/libs/jquery/jquery-1-4ed679c998.11.3.min.js"></script>
<script src="/resource/libs/ajaxfileupload-20caa375ef.js"></script>
<script src="/resource/ui-framework/bootstrap/3.0.3/js/bootstrap-7b3098bda9.min.js"></script>
<script src="/resource/ui-framework/bootstrap-daterangepicker/js/moment-zh_cn-3d8809ccd6.js"></script>
<script src="/resource/ui-framework/bootstrap-daterangepicker/js/daterangepicker-bca1a72d19.js"></script>
<script src="/resource/ui-framework/admin-lte/app-bf15eda982.js"></script>
<script src="/static/js/layer/layer.js"></script>
<script type="text/javascript">
$().ready(function () {
    var url = $('#hdnURL').val();
    $('.sidebar .treeview').each(function (index, item) {
        var btn = $(this).children("a").first();
        var menu = $(this).children(".treeview-menu").first();
        $(this).find('a').each(function (index, item) {
            if ($(item).attr('href') == url) {
                menu.show();
                btn.children(".fa-angle-left").first().removeClass("fa-angle-left").addClass("fa-angle-down");
            }
        });
    });
});
function btnUpdate(){
    var id = {$group.id};
    var ids = '';
    $('input[name="ids[]"]:checked').each(function(){
        if(ids){
            ids = ids+','+$(this).val();
        }else{
            ids = $(this).val();
        }
    })
    $.post('/index/Authgroup/rulelist',{id:id,ids:ids},function(res){
        if(res.code == 1){
            layer.msg(res.msg);
            window.setTimeout(function(){
                window.location.reload();
            },1000)
        }else{
            layer.msg(res.msg);
        }
    })
}
</script>
{/block}